package CtrlLayer;
import java.util.ArrayList;
import ModelLayer.Customer;
import ModelLayer.CustomerContainer;


/**
 * Write a description of class CustomerController here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class CustomerController
{
    private CustomerContainer customerContainer;
    private Customer customer;
    
    public CustomerController()
    {
        customerContainer = CustomerContainer.getInstance();
    }
    
    public boolean addCustomer(Customer c)
    {
        return customerContainer.addCustomer(c);
    }

    public Customer findCustomerById(int customerId)
    {
        return customerContainer.findCustomerById(customerId);
    }
    
    public void deleteCustomerById(int customerId)
    {
        customerContainer.deleteCustomerById(customerId);
    }
    
    public void updateCustomer(int customerId, String name, String address, String city, String postCode, String eMail)
    {
        findCustomerById(customerId).setName(name);
        findCustomerById(customerId).setAddress(address);
        findCustomerById(customerId).setCity(city);
        findCustomerById(customerId).setPostCode(postCode);
        findCustomerById(customerId).setEMail(eMail);        
    }
    
    public void updateDiscount(int customerId, double discount)
    {
        findCustomerById(customerId).setDiscount(discount);
    }
}
